package org.tong.conf;

import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

@Configuration
public class SystemConf {

    @Bean
    public Producer captcha() {
        Properties properties = new Properties();
        properties.put("kaptcha.image.width", "150");
        properties.put("kaptcha.image.height", "50");
        properties.put("kaptcha.textproducer.char.string", "0123456789");
        properties.put("kaptcha.textproducer.char.length", "4");
        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
        defaultKaptcha.setConfig(new Config(properties));
        return defaultKaptcha;
    }
}
